<?php
namespace app\admin\model;

use \think\Model as Model;
class PaperChoice extends Model{
    protected $table = "edu_paper_choice";
    protected $pk = 'ch_id';

    /**
     * 获取单个试题
     * 
     * @id 试卷的id
     * @return array
     * @date Wed Jun 20 18:29:44 2018
     */
    public function getchoice($id){
        $data = $this->alias('ch')->join($this->getTable('paper').' pap','ch.pap_id = pap.pap_id')
              ->where(['ch_id'=>$id])->find();
        $data['ch_options'] = unserialize($data['ch_options']);
        $data['ch_result'] = unserialize($data['ch_result']);
        return $data;
    }
}
